import http from "@/utils/http";
const env = import.meta.env;
const url = "https://yfd.saas.api.corpvip.top";
const BASE_URL = env.PROD ? `${url}/api` : "/api";

/** @desc 通过code获取openId-无需授权 */
export function getOpenIdBase(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/getWxOpenidByCode`, params);
}

/** @desc 通过code获取openId-需授权 */
export function getOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/getWxOpenidByAuthCode`, params);
}

/** @desc 获取用户信息 */
export function getWeChatInfoByOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/getWeChatInfoByOpenId`, params);
}

/** @desc 获取邀请明细列表 */
export function getWeChatInviteListByOpenId(params) {
  return http.post(
    `${BASE_URL}/v1/lj/wechat/getWeChatInviteListByOpenId`,
    params
  );
}

/** @desc 获取商品列表 */
export function getGoodsListByOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/getGoodsListByOpenId`, params);
}

/** @desc 领取商品 */
export function receiveGoodsByOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/receiveGoodsByOpenId`, params);
}

/** @desc 投诉举报 */
export function report(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/report`, params);
}

/** @desc 上传图片 */
export function picUpload(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/picUpload`, params, {
    "Content-Type": "multipart-formData",
  });
}

/** @desc 判断是否绑定群 */
export function isBindGroupByOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/isBindGroupByOpenId`, params);
}

/** @desc 判断是否在群 */
export function isInGroupByOpenId(params) {
  return http.post(`${BASE_URL}/v1/lj/wechat/isInGroupByOpenId`, params);
}

/** @desc  */
export function getWxConfigParams(params) {
  return http.get(
    `https://inspect-api.maishou88.com/api/v1/wx/getWxConfigParams`,
    params
  );
}
